<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .red {
            color: red;
        }
    </style>
</head>

<body>
    <h1>
    </h1>
    <script>
        var span = "ueirvenrveioeon"
        var num = span.split("")
        var h = document.querySelector("h1")
        num.forEach(function (item, key) {
            var span1 = document.createElement("span")
            span1.innerHTML = item
            h.appendChild(span1)
        })
        var span11 = document.querySelectorAll("span")
        console.log(span11)
        document.onkeydown = function (e) {
            var e = e || window.event
            var key = e.key;
            span11.forEach(function (item) {
                if (key == item.innerHTML) {
                    item.style.color = "red"
                }
            })
        }



    </script>
</body>

</html>